package com.yxw.yxnet_cd_center.customer_service.controller;

import com.yxw.yxnet_cd_center.common.dto.PageVO;
import com.yxw.yxnet_cd_center.common.helper.ResultHelper;
import com.yxw.yxnet_cd_center.common.utils.BaseResult;
import com.yxw.yxnet_cd_center.customer_service.dto.NoticeAddDTO;
import com.yxw.yxnet_cd_center.customer_service.dto.VoiceLibAddDTO;
import com.yxw.yxnet_cd_center.customer_service.dto.VoiceLibQueryDTO;
import com.yxw.yxnet_cd_center.customer_service.service.VoiceLibService;
import com.yxw.yxnet_cd_center.customer_service.vo.YxCsGroupVo;
import com.yxw.yxnet_cd_center.customer_service.vo.YxCsVoiceLibVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * 语音库管理
 * @author liuxin
 * @date 2023.09.17
 */
@RestController
@Api(value = "语音库管理", tags = "语音库管理")
@Slf4j
@RequestMapping("/voiceLib")
public class VoiceLibController {

    @Autowired
    private VoiceLibService voiceLibService;


    @ApiOperation(value = "语音库列表查询")
    @PostMapping(value = "/getVoiceLibList")
    public BaseResult<PageVO<YxCsVoiceLibVo>> getVoiceLibList(@RequestBody VoiceLibQueryDTO dto) {
        PageVO<YxCsVoiceLibVo> pageVo=voiceLibService.getVoiceLibList(dto);
        return ResultHelper.fillWithSuccess(pageVo);
    }

    @ApiOperation(value = "新增语音库")
    @PostMapping(value = "/addVoiceLib")
    public BaseResult addVoiceLib(@RequestBody @Validated VoiceLibAddDTO dto) {
        YxCsVoiceLibVo vo=voiceLibService.addVoiceLib(dto);
        return BaseResult.doSuccess(vo,"新增成功");
    }

    @ApiOperation(value = "删除语音库")
    @DeleteMapping(value = "/deleteVoiceLibById")
    public BaseResult deleteVoiceLibById(Long id) {
        voiceLibService.deleteVoiceLibById(id);
        return BaseResult.doSuccess(null,"删除成功");
    }
    @ApiOperation(value = "语音库状态修改")
    @PostMapping(value = "/updateStatusById")
    public BaseResult updateStatusById(Long id) {
        voiceLibService.updateStatusById(id);
        return BaseResult.doSuccess(null,"设置成功");
    }
}
